<template>
  <div id="box">
    <div style="text-align: right;">
      <el-button @click="saveTreatment()" type="primary">保存</el-button>
    </div>
    <!-- 介入治疗 -->
    <div v-if="hide && display" class="bottomBox">
      <div class="topConter">
        <el-row :gutter="20" v-show="dis_779">
          <el-col :span="6" v-show="dis_779">
            <span class="red-star">激活导管室 ：</span>
            <el-date-picker v-model="cont.obj_113.hit_time" type="datetime" style="width: 64%;"
              value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
          </el-col>
          <el-col :span="6">
            <span>介入医师 ： </span>
            <el-input v-model="cont.obj_50710.detail" placeholder="请输入内容" style="width: 50%;" size="mini"></el-input>
          </el-col>
          <el-col :span="6">
            <span>患者到达导管室 ：</span>
            <el-date-picker v-model="cont.obj_114.hit_time" type="datetime" style="width: 60%;"
              value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
          </el-col>
          <el-col :span="6" style="height: 28px;line-height: 28px;">
            <span>是否直达导管室 ：</span>
            <el-radio-group v-model="cont.obj_713.property2" size="mini">
              <el-radio label="1">是</el-radio>
              <el-radio label="0">否</el-radio>
            </el-radio-group>
          </el-col>
          <el-col :span="6" style="height: 28px;line-height: 28px;">
            <span class="red-star">绕行急诊 ：</span>
            <el-radio-group v-model="dispatch_data.is_bypass_emergency" @change="changeRX" size="mini">
              <el-radio label="1">是</el-radio>
              <el-radio label="0">否</el-radio>
            </el-radio-group>
          </el-col>
          <el-col :span="6" style="height: 28px;line-height: 28px;">
            <span class="red-star">绕行CCU ：</span>
            <el-radio-group v-model="dispatch_data.is_bypass_ccu" @change="changeRX" size="mini">
              <el-radio label="1">是</el-radio>
              <el-radio label="0">否</el-radio>
            </el-radio-group>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="7" style="height: 28px;line-height: 28px;" v-show="dis_770">
            <span>TIMI血流分级 ： </span>
            <el-radio-group v-model="gradingList.preoperativeTimiLevel">
              <el-radio label="0">0级</el-radio>
              <el-radio label="1">1级</el-radio>
              <el-radio label="2">2级</el-radio>
              <el-radio label="3">3级</el-radio>
            </el-radio-group>
          </el-col>
          <el-col :span="8" v-if="dis_D2W">
            <div>
              <span>D2W时间 ：</span>
              <el-input v-model="inputTime" placeholder="" style="width: 40%;" size="mini" disabled>
                <template slot="append">min</template>
              </el-input>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="20" v-show="dis_779">
          <el-col :span="8" style="height: 28px;line-height: 28px;">
            <span>术中抗凝药物 ： </span>
            <el-radio-group v-model="cont.obj_663.property2">
              <el-radio label="1">普通肝素</el-radio>
              <el-radio label="2">低分子肝素</el-radio>
              <el-radio label="3">比伐卢定</el-radio>
              <el-radio label="4">黄达肝葵钠</el-radio>
            </el-radio-group>
          </el-col>
          <el-col :span="8">
            <span>术中抗凝药物剂量 ：</span>
            <el-input @change="changeTime(cont.obj_711.detail)" v-model="cont.obj_711.detail" placeholder="输入剂量"
              style="width: 30%;margin-right: 5px;" size="mini"></el-input>
            <el-input @change="changeTime(cont.obj_712.detail)" v-model="cont.obj_712.detail" placeholder="单位"
              style="width: 20%;" size="mini"></el-input>
          </el-col>
          <el-col :span="8">
            <span
              :class="conditions.some(el => this.checkrowdata.diagnoseContent.includes(el)) ? '' : 'red-star'">术中抗凝给药时间
              ：</span>
            <el-date-picker v-model="cont.obj_766.hit_time" type="datetime" style="width:50%;"
              value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6" style="height: 28px;line-height: 28px;">
            <span class="red-star">入路 ：</span>
            <el-radio-group v-model="cont.obj_664.property2">
              <el-radio label="1">桡动脉(左侧)</el-radio>
              <el-radio label="2">桡动脉(右侧)</el-radio>
              <el-radio label="3">股动脉</el-radio>
              <el-radio label="4">其他</el-radio>
            </el-radio-group>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8" v-show="dis_662">
            <span>介入手术开始：</span>
            <el-date-picker v-model="cont.obj_662.hit_time" type="datetime" style="width: 68%;"
              value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
          </el-col>

          <el-col :span="6" v-show="dis_779">
            <span>开始穿刺 ：</span>
            <el-date-picker v-model="cont.obj_441.hit_time" type="datetime" style="width: 68%;"
              value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
          </el-col>
          <el-col :span="6" v-show="dis_490">
            <span>穿刺成功 ：</span>
            <el-date-picker v-model="cont.obj_490.hit_time" type="datetime" style="width: 68%;"
              value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6" v-show="dis_770">
            <span>开始造影 ：</span>
            <el-date-picker v-model="cont.obj_117.hit_time" type="datetime" style="width: 68%;"
              value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
          </el-col>
          <el-col :span="6" v-show="dis_118">
            <span>造影结束 ：</span>
            <el-date-picker v-model="cont.obj_118.hit_time" type="datetime" style="width: 68%;"
              value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div>
              <span>冠脉造影</span>
            </div>
          </el-col>
        </el-row>
        <div class="bottonConter">
          <el-row>
            <el-col style="width: 20%;" :span="6">
              <div>
                <img src="@/images/position.png" style="width: 100%;height: 100%;" alt="" />
              </div>
            </el-col>
            <el-col style="margin-left: 100px;" :span="15">
              <div v-for="(cArrItem, index) in crownShadowArr" :key="index">
                <span>{{ cArrItem.top.name }}</span>
                <el-checkbox-group style="height: 80px;line-height: 40px;margin-left:20px ;" v-model="cagList_666">
                  <el-checkbox v-for="(topItem, tIndex) in cArrItem.top.list" :key="tIndex" @change="one_666"
                    :label="topItem">{{ topItem }}</el-checkbox>
                </el-checkbox-group>
                <div style="margin-top: 20px;">
                  <span>{{ cArrItem.bottom.name }}</span>
                  <el-checkbox-group style="height: 80px;line-height: 40px;margin-left:20px ;" v-model="cagList_666">
                    <el-checkbox @change="one_666" v-for="(bottomItem, bIndex) in cArrItem.bottom.list" :key="bIndex"
                      :label="bottomItem">{{ bottomItem }}</el-checkbox>
                  </el-checkbox-group>
                </div>
              </div>
            </el-col>
          </el-row>
          <el-row v-for="(cagItem) in cagItemList_666" :key="cagItem.portindex"
            style="margin-top: 20px; border-bottom:1px solid gray;">
            <span>{{ cagItem.portindex }}: {{ cagItem.portname }}</span>
            <el-row :gutter="20">
              <el-col :span="6">
                <div>
                  <span class="red-star">狭窄程度 ： </span>
                  <el-select v-model="cagItem.portparam[0]" size="mini" placeholder="请选择狭窄程度">
                    <el-option label="＜50%" value="1 狭窄程度 ＜50%"> </el-option>
                    <el-option label="50~69%" value="2 狭窄程度 50~69%"> </el-option>
                    <el-option label="70~89%" value="3 狭窄程度 70~89%"> </el-option>
                    <el-option label="90~99%" value="4 狭窄程度 90~99%"> </el-option>
                    <el-option label="100%" value="5 狭窄程度 100%"> </el-option>
                  </el-select>
                </div>
              </el-col>
              <el-col :span="6">
                <div>
                  <span class="red-star">造影时TIMI血流 ：</span>
                  <el-select v-model="cagItem.portparam[1]" size="mini" placeholder="请选择血流分级">
                    <el-option label="0级" value="0 造影时TIMI血流 0级"> </el-option>
                    <el-option label="1级" value="1 造影时TIMI血流 1级"> </el-option>
                    <el-option label="2级" value="2 造影时TIMI血流 2级"> </el-option>
                    <el-option label="3级" value="3 造影时TIMI血流 3级"> </el-option>
                  </el-select>
                </div>
              </el-col>
              <el-col :span="6">
                <div>
                  <span class="red-star">支架内血栓 ：</span>
                  <el-radio-group v-model="cagItem.portparam[2]" size="mini">
                    <el-radio label="1 支架内血栓 是">是</el-radio>
                    <el-radio label="0 支架内血栓 否">否</el-radio>
                  </el-radio-group>
                </div>
              </el-col>
              <el-col :span="6">
                <div>
                  <span class="red-star">是否分叉病变 ：</span>
                  <el-radio-group v-model="cagItem.portparam[3]" size="mini">
                    <el-radio label="1 是否分叉病变 是">是</el-radio>
                    <el-radio label="0 是否分叉病变 否">否</el-radio>
                  </el-radio-group>
                </div>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="6">
                <div>
                  <span class="red-star">是否CTO ： </span>
                  <el-radio-group v-model="cagItem.portparam[4]" size="mini">
                    <el-radio label="1 是否CTO 是">是</el-radio>
                    <el-radio label="0 是否CTO 否">否</el-radio>
                  </el-radio-group>
                </div>
              </el-col>
              <el-col :span="6">
                <div>
                  <span class="red-star">钙化病变 ：</span>
                  <el-radio-group v-model="cagItem.portparam[5]" size="mini">
                    <el-radio label="1 钙化病变 是">是</el-radio>
                    <el-radio label="0 钙化病变 否">否</el-radio>
                  </el-radio-group>
                </div>
              </el-col>
              <el-col :span="6">
                <div>
                  <span class="red-star">罪犯病变 ：</span>
                  <el-radio-group v-model="cagItem.portparam[6]" size="mini">
                    <el-radio label="1 罪犯病变 是">是</el-radio>
                    <el-radio label="0 罪犯病变 否">否</el-radio>
                  </el-radio-group>
                </div>
              </el-col>
              <el-col :span="6">
                <div>
                  <span class="red-star">PCI ：</span>
                  <el-radio-group v-model="cagItem.portparam[7]" size="mini">
                    <el-radio label="1 PCI 是">是</el-radio>
                    <el-radio label="0 PCI 否">否</el-radio>
                  </el-radio-group>
                </div>
              </el-col>
            </el-row>
            <el-row v-show="cagItem.portparam[7] === '1 PCI 是'">
              <el-col style="margin: 10px 0;" :span="24">
                <div>
                  <span class="red-star">术中处理 ：</span>
                  <el-select @change="handlecheck_666" v-model="cagItem.portparam[13]" style="width: 85%;" size="small"
                    multiple placeholder="请选择">
                    <el-option v-for="(item, index) in option_66666" :key="index" :label="index" :value="index">
                    </el-option>
                  </el-select>
                </div>
              </el-col>
              <el-col :span="5">
                <div>
                  <span>导丝通过时间 ： </span>
                  <el-date-picker v-model="cagItem.portparam[9]" type="datetime" style="width: 60%;"
                    value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="5">
                <div>
                  <span class="red-star">术后TIMI血流 ：</span>
                  <el-select v-model="cagItem.portparam[10]" size="mini" placeholder="请选择血流分级">
                    <el-option label="0级" value="1 术后TIMI血流 0级"> </el-option>
                    <el-option label="1级" value="2 术后TIMI血流 1级"> </el-option>
                    <el-option label="2级" value="3 术后TIMI血流 2级"> </el-option>
                    <el-option label="3级" value="4 术后TIMI血流 3级"> </el-option>
                  </el-select>
                </div>
              </el-col>
              <el-col :span="5">
                <div>
                  <span :class="cagItem.portparam[11] == '1 植入支架个数 0枚' ? '' : 'red-star'">植入支架个数 ： </span>
                  <el-select v-model="cagItem.portparam[11]" size="mini" placeholder="请选择支架个数">
                    <el-option label="0枚" value="1 植入支架个数 0枚"> </el-option>
                    <el-option label="1枚" value="2 植入支架个数 1枚"> </el-option>
                    <el-option label="2枚" value="3 植入支架个数 2枚"> </el-option>
                    <el-option label="≥3枚" value="4 植入支架个数 ≥3枚"> </el-option>
                  </el-select>
                </div>
              </el-col>
              <el-col :span="5">
                <div>
                  <span :class="cagItem.portparam[11] == '1 植入支架个数 0枚' ? '' : 'red-star'">支架种类 ：</span>
                  <el-select v-model="cagItem.portparam[12]" size="mini" placeholder="请选择支架种类">
                    <el-option label="BMS" value="1 支架种类 BMS"> </el-option>
                    <el-option label="DES" value="2 支架种类 DES"> </el-option>
                    <el-option label="可降解支架" value="3 支架种类 可降解支架"> </el-option>
                    <el-option label="其他" value="4 支架种类 其他"> </el-option>
                  </el-select>
                </div>
              </el-col>
            </el-row>
          </el-row>
        </div>
        <el-row :gutter="20">
          <el-col :span="7" style="height: 28px;line-height: 28px;">
            <span style="margin-right: 20px;">腔内影像 ：</span>
            <el-radio-group v-model="cont.obj_667.property2">
              <el-radio label="1">IVUS</el-radio>
              <el-radio label="2">OCT</el-radio>
              <el-radio label="3">其他</el-radio>
              <el-radio label="4">未做</el-radio>
            </el-radio-group>
          </el-col>
          <el-col :span="7" style="height: 28px;line-height: 28px;">
            <span style="margin-right: 20px;">功能检测 ：</span>
            <el-radio-group v-model="radio_668">
              <el-radio label="1">FFR</el-radio>
              <el-radio label="2">其他</el-radio>
              <el-radio label="3">未做</el-radio>
              <el-radio label="4">iFR</el-radio>
              <el-radio label="5">IMR</el-radio>
            </el-radio-group>
          </el-col>
          <el-col v-show="radio_668 === '1' || radio_668 === '4' || radio_668 === '5'" :span="2">
            <div>
              <span>输入值 ：</span>
              <el-input v-model="input_668" placeholder="" style="width: 60%;margin-right: 5px;" size="mini"></el-input>
            </div>
          </el-col>
          <!-- <el-col :span="6">
            <span>血栓抽吸：</span>
            <el-radio-group v-model="cont.obj_669.property2" size="mini">
            	<el-radio label="1">是</el-radio>
            	<el-radio label="0">否</el-radio>
            </el-radio-group>
					</el-col> -->
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6" style="height: 28px;line-height: 28px;">
            <span>IABP ：</span>
            <el-radio-group v-model="cont.obj_670.property2" size="mini">
              <el-radio label="1">是</el-radio>
              <el-radio label="0">否</el-radio>
            </el-radio-group>
          </el-col>
          <el-col :span="6" style="height: 28px;line-height: 28px;">
            <span>临时起搏器 ：</span>
            <el-radio-group v-model="cont.obj_671.property2" size="mini">
              <el-radio label="1">是</el-radio>
              <el-radio label="0">否</el-radio>
            </el-radio-group>
          </el-col>
          <el-col :span="6" style="height: 28px;line-height: 28px;">
            <span>ECMO ：</span>
            <el-radio-group v-model="cont.obj_672.property2" size="mini">
              <el-radio label="1">是</el-radio>
              <el-radio label="0">否</el-radio>
            </el-radio-group>
          </el-col>
          <el-col :span="6" style="height: 28px;line-height: 28px;">
            <span>左心室辅助装置 ：</span>
            <el-radio-group v-model="cont.obj_673.property2" size="mini">
              <el-radio label="1">是</el-radio>
              <el-radio label="0">否</el-radio>
            </el-radio-group>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24">
            <span>术中并发症 ： </span>
            <el-checkbox-group style="height: 30px;line-height: 40px;margin-left:20px ;" @change="handleCheck_675"
              v-model="value_675">
              <el-checkbox v-for="item_675 in option_675" :key="item_675.value_675" :label="item_675.value_675">{{
                item_675.label }}</el-checkbox>
            </el-checkbox-group>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="5">
            <div>
              <span>手术结束时间 ： </span>
              <el-date-picker v-model="cont.obj_120.hit_time" type="datetime" style="width: 60%;"
                value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
            </div>
          </el-col>
        </el-row>
        <el-row v-show="dis_779 && hidden" style="height: 100px;">
          <span>延误原因 ：</span>
          <el-col :span="24">
            <el-checkbox-group style="line-height: 30px;margin-left:20px ;" v-model="checkListThree">
              <el-checkbox label="01">症状不明显延误诊断</el-checkbox>
              <el-checkbox label="02">家属未到场</el-checkbox>
              <el-checkbox label="03">医生决策延误</el-checkbox>
              <el-checkbox label="04">排队挂号、缴费、办住院时间长</el-checkbox>
              <el-checkbox label="05">急诊科处理时间长</el-checkbox>
              <el-checkbox label="06">手术期间出现并发症</el-checkbox>
              <el-checkbox label="07">超过再灌注时间</el-checkbox>
              <el-checkbox label="08">未实施绕行急诊方案</el-checkbox>
              <el-checkbox label="09">导管室人员未到位</el-checkbox>
              <el-checkbox label="10">药物缺乏</el-checkbox>
              <el-checkbox label="11">知情同意时间过长</el-checkbox>
              <el-checkbox label="12">病情不稳定</el-checkbox>
              <el-checkbox label="13">绕行急诊科但未直接入导管室</el-checkbox>
              <el-checkbox label="14">导管室占台</el-checkbox>
              <el-checkbox label="15">转运时间长</el-checkbox>
              <el-checkbox label="16">经费问题</el-checkbox>
              <el-checkbox label="17">心内科会诊时间长</el-checkbox>
              <el-checkbox label="18">血管通路困难</el-checkbox>
              <el-checkbox label="19">难以绕行病变区域</el-checkbox>
              <el-checkbox label="20">心脏骤停或需要气管插管再PCI</el-checkbox>
              <el-checkbox label="21">急需影像学资料再行PCI</el-checkbox>
              <el-checkbox label="99">其他原因</el-checkbox>
            </el-checkbox-group>
          </el-col>
        </el-row>
      </div>
    </div>
    <!-- 介入治疗切换  -->
    <div v-if="hide === false"
      style="background-color: #F9F9F9;width: 100%;height: 300px;text-align: center;line-height: 300px;">
      <h1>请补充初步诊断和处理措施！</h1>
    </div>
    <div v-if="display === false"
      style="background-color: #F9F9F9;width: 100%;height: 300px;text-align: center;line-height: 300px;">
      <h1>不需填写介入治疗内容！</h1>
    </div>
    <!-- 保守 -->
    <div class="bottomBox">
      <el-row>
        <el-col :span="12">
          <div>
            <span>保守</span>
          </div>
        </el-col>
      </el-row>
      <div class="topConter">
        <el-row :gutter="20">
          <el-col :span="8">
            <div>
              <span>谈话 ：</span>
              <el-date-picker v-model="cont.obj_597.hit_time" type="datetime" style="width: 60%;"
                value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
            </div>
          </el-col>
          <el-col :span="8">
            <div>
              <span>原因 ：</span>
              <el-select v-model="value_conservative" style="width: 85%;" size="mini" multiple placeholder="请选择">
                <el-option v-for="item_conservative in option_conservative" :key="item_conservative.value_conservative"
                  :label="item_conservative.label" :value="item_conservative.value_conservative">
                </el-option>
              </el-select>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
    <!-- 放弃 -->
    <div class="bottomBox">
      <el-row>
        <el-col :span="12">
          <div>
            <span>放弃</span>
          </div>
        </el-col>
      </el-row>
      <div class="topConter">
        <el-row :gutter="20">
          <el-col :span="8">
            <div>
              <span>谈话 ：</span>
              <el-date-picker v-model="cont.obj_598.hit_time" type="datetime" style="width: 60%;"
                value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
            </div>
          </el-col>
          <el-col :span="8">
            <div>
              <span>放弃治疗知情同意 ：</span>
              <el-date-picker v-model="cont.obj_594.hit_time" type="datetime" style="width: 60%;"
                value-format="yyyy-MM-dd HH:mm:ss" size="mini" placeholder="选择日期时间" />
            </div>
          </el-col>
          <el-col :span="8">
            <div>
              <span>原因 ：</span>
              <el-select v-model="value_giveUp" style="width: 85%;" size="mini" multiple placeholder="请选择">
                <el-option v-for="item_giveUp in option_giveUp" :key="item_giveUp.value_giveUp"
                  :label="item_giveUp.label" :value="item_giveUp.value_giveUp">
                </el-option>
              </el-select>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
import {
  queryEventTouchsData,
  queryFindChipsData,
  querySurgeriesData,
  querysaveTreatmentData,
  queryFindChipsConservativeData,
  queryFindChipsGiveupData,
  findDiagnosesClcs,
  getDispatchData,
  modifyDispatchData,
  saveCag
} from '@/api/green-channel/treatment.js'
import format from '@/utils/format.js'
import { Number } from 'core-js';
export default {
  name: 'Treatment',
  props: ['checkrowdata'], // 由主页面(父组件) 接收来的, 选择项的数据
  data() {
    return {
      /* 控制页面切换 */
      hide: false,
      display: false,
      dis_779: false,
      dis_662: false,
      dis_662: false,
      dis_490: false,
      dis_118: false,
      dis_770: false,
      dis_D2W: false,
      hidden: true,
      inputTime: '',
      /* ---------- */
      input_668: '', // 功能检查输入值
      /* 选择框--- */
      /* 溶栓筛查 */
      radio_204: '',
      input_204: '',
      option_675: [{
        value_675: '00',
        label: '无'
      }, {
        value_675: '01',
        label: '恶性心律失常'
      }, {
        value_675: '02',
        label: '低血压'
      }, {
        value_675: '03',
        label: '慢血流/无复流'
      }, {
        value_675: '04',
        label: '血管夹层'
      }, {
        value_675: '05',
        label: '非干预血管急性闭塞'
      }, {
        value_675: '06',
        label: '血管穿孔'
      }, {
        value_675: '07',
        label: '死亡'
      },
      {
        value_675: '08',
        label: '心源性休克'
      }, {
        value_675: '09',
        label: '严重缓慢型心律失常'
      },
      {
        value_675: '10',
        label: '血栓栓塞'
      }, {
        value_675: '99',
        label: '其他'
      }],
      value_675: ['00'],
      radio_668: '',
      /* end---- */
      checkListThree: [], // 延误原因选中数组
      saveDataList: {}, // 保存参数列表
      /* 溶栓----- */
      cont: {
        obj_596: {},
        obj_704: {},
        obj_705: {},
        obj_204: {},
        obj_206: {},
        obj_57: {},
        obj_104: {},
        obj_498: {},
        obj_708: {},
        obj_709: {},
        /* 介入 */
        obj_595: {},
        obj_50710: {},
        obj_592: {},
        obj_576: {},
        obj_593: {},
        obj_112: {},
        obj_113: {},
        obj_114: {},
        obj_713: {},
        obj_662: {},
        obj_663: {},
        obj_711: {},
        obj_712: {},
        obj_664: {},
        obj_441: {},
        obj_490: {},
        obj_117: {},
        obj_118: {},
        obj_665: {},
        obj_666: {},
        obj_667: {},
        obj_668: {},
        obj_669: {},
        obj_670: {},
        obj_671: {},
        obj_672: {},
        obj_673: {},
        obj_675: {},
        obj_120: {},
        obj_676: {},
        obj_766: {},
        obj_597: {}, // 保守谈话
        obj_598: {}, // 放弃谈话
        obj_594: {} // 放弃治疗知情同意
      },
      cureObj: {},
      /* eventTouch */
      numberList: [
        '596', '704', '705', '204', '206', '57', '104', '498', '708', '709', '595', '50710', '592', '576', '593', '112',
        '113', '114', '713', '662', '663', '711', '712', '664', '441', '490', '117', '118', '665', '666', '667', '668',
        '669', '670', '671', '672', '673', '675', '120', '676', '597', '598', '594', '766'
      ],
      /* -血流分级- */
      gradingList: {},
      gradvalue: '',
      cagList_666: [], // 选中的项
      cagItemList_666: [], // 冠影选中项列表
      /* 冠脉造影列表 */
      crownShadowArr: {
        data: {
          top: {
            name: '冠脉造影',
            list: ['1:右冠近段', '2:右冠中段', '3:右冠远段', '4:后降支', '5:左主干', '6:前降支近段', '7:前降支中段', '8:前降支远段', '9:第一对角支', '10:第二对角支', '11:旋支近段', '12:第一钝缘支', '13:旋支远段', '14:左室后支', '15:后降支']
          },
          bottom: {
            name: '其他',
            list: ['16:中间支', '17:第三对角支', '18:第二钝缘支', '19:第三钝缘支', '20:锐缘支', '21:左圆椎支', '22:右圆椎支', '23:室间隔支', '24:左后外侧支', '25:右后外侧支', '26:房室沟动脉', '27:后降支室间支']
          }
        }
      },
      // 冠影术中处理
      option_66666: {
        '无': 0,
        '植入支架': 1,
        'PTCA': 2,
        '血栓抽吸': 3,
        '冠脉内溶栓': 4,
        '仅使用导丝': 5,
        '其他': 9
      },
      // value_666: [],
      afterOperation: [], // 术后处理列表
      /* 溶栓药数据  */
      findchipsByInstance: {},
      jsonObj: {},
      /* 溶栓药、剂量、治疗过程并发症 */
      options_drug: [{
        value_drug: '第一代',
        label: '第一代'
      }, {
        value_drug: '第二代',
        label: '第二代'
      }, {
        value_drug: '第三代',
        label: '第三代'
      }],
      options_dose: [{
        value_dose: '全量',
        label: '全量'
      }, {
        value_dose: '半量',
        label: '半量'
      }],
      option_pro: [{
        value_pro: '无',
        label: '无'
      }, {
        value_pro: '恶性心律失常',
        label: '恶性心律失常'
      }, {
        value_pro: '低血压',
        label: '低血压'
      }, {
        value_pro: '慢血流/无复流',
        label: '慢血流/无复流'
      }, {
        value_pro: '血管夹层',
        label: '血管夹层'
      }, {
        value_pro: '非干预血管急性闭塞',
        label: '非干预血管急性闭塞'
      }, {
        value_pro: '血管穿孔',
        label: '血管穿孔'
      }, {
        value_pro: '死亡',
        label: '死亡'
      }, {
        value_pro: '心源性休克',
        label: '心源性休克'
      }, {
        value_pro: '严重缓慢型心律失常',
        label: '严重缓慢型心律失常'
      }, {
        value_pro: '血栓栓塞',
        label: '血栓栓塞'
      }, {
        value_pro: '其他',
        label: '其他'
      }],
      value_pro: [],
      conservativeJosn: '', // 保守原因
      option_conservative: [{
        value_conservative: '1',
        label: '生命体征平稳，无持续缺血表现'
      }, {
        value_conservative: '2',
        label: '超过再灌注时间窗'
      }, {
        value_conservative: '3',
        label: '高出血风险'
      }, {
        value_conservative: '4',
        label: '严重肝肾功能不全'
      }, {
        value_conservative: '5',
        label: '经济原因限制'
      }, {
        value_conservative: '6',
        label: '拒绝或放弃'
      }, {
        value_conservative: '7',
        label: '出血活动期'
      }, {
        value_conservative: '9',
        label: '其他原因'
      }],
      value_conservative: [], // 保守原因
      option_giveUp: [{
        value_giveUp: '1',
        label: '生命体征平稳，无持续缺血表现'
      }, {
        value_giveUp: '2',
        label: '超过再灌注时间窗'
      }, {
        value_giveUp: '3',
        label: '高出血风险'
      }, {
        value_giveUp: '4',
        label: '严重肝肾功能不全'
      }, {
        value_giveUp: '5',
        label: '经济原因限制'
      }, {
        value_giveUp: '6',
        label: '拒绝或放弃'
      }, {
        value_giveUp: '7',
        label: '出血活动期'
      }, {
        value_giveUp: '9',
        label: '其他原因'
      }],
      value_giveUp: [], // 放弃原因
      reason: [{}, {}], // 保存 保守,放弃原因
      dispatch_data: '',
      conditions: ["STEMI", "NSTEMI", "UA"]
    }
  },
  created() {
    this.getEventTouchData()
    this.getDispatchData()

  },
  methods: {
    changeTime(value) {
      if (!this.cont.obj_766.hit_time) {
        this.cont.obj_766.hit_time = format(new Date(), 'YYYY-MM-DD HH:mm:ss')
      }
    },
    getEventTouchData() {
      let itemType = 'thrombolysisOrder'
      this.cagList_666 = []
      // let dispatch = 103389
      let dispatch = this.checkrowdata.dispatchId
      queryFindChipsData(itemType, dispatch).then(res => {
        this.findchipsByInstance = res.data.chipsOrder[0]
        if (res.data.chipsOrder.length === 0) {
          this.findchipsByInstance = {
            json: {},
            id: null,
            userId: this.$store.getters.userId,
            missionid: this.checkrowdata.dispatchId,
            medicalId: this.checkrowdata.medicalId,
            status: true,
            instanceType: 'thrombolysisOrder',
            itemName: '溶栓手术',
            itemType: 'thrombolysisOrder'
          }
          this.jsonObj = {
            medicineName: '',
            dosage: ''
          }
          this.value_pro = []
        } else {
          this.jsonObj = res.data.chipsOrder[0].json
          if (res.data.chipsOrder[0].json.complication === null) {
            this.value_pro = []
          } else {
            if (res.data.chipsOrder[0].json.complication === '') {
              this.value_pro = []
            } else {
              this.value_pro = res.data.chipsOrder[0].json.complication ? res.data.chipsOrder[0].json.complication.split(';') : []
            }
          }
        }
      }).catch(err => {
        console.log(err)
      })
      /*  Conservative 治疗 */
      queryFindChipsConservativeData(dispatch).then(res => {
        if (res.data.chipsOrder.length === 0) {
          this.reason[0] = {
            id: null,
            missionid: this.checkrowdata.dispatchId,
            medicalId: this.checkrowdata.medicalId,
            status: true,
            userId: this.$store.getters.userId,
            instanceType: 'conservative',
            polarity: 0,
            json: '',
            version: 0,
            judgement: 0,
            hasAudio: false,
            hasPhoto: false
          }
        } else {
          this.reason[0] = res.data.chipsOrder[0]
          let conservativeJosn = res.data.chipsOrder[0].json
          let conservative = conservativeJosn ? conservativeJosn.split('~') : []
          if (conservative[1] === '') {
            this.value_conservative = []
          } else {
            this.value_conservative = conservative[1].split('|')
          }
        }
      }).catch(err => {
        console.log(err)
      })
      /* Giveup 治疗 */
      queryFindChipsGiveupData(dispatch).then(res => {
        if (res.data.chipsOrder.length === 0) {
          this.reason[1] = {
            id: null,
            missionid: this.checkrowdata.dispatchId,
            medicalId: this.checkrowdata.medicalId,
            status: true,
            userId: this.$store.getters.userId,
            instanceType: "giveup",
            polarity: 0,
            json: '',
            version: 0,
            judgement: 0,
            hasAudio: false,
            hasPhoto: false
          }
        } else {
          this.reason[1] = res.data.chipsOrder[0]
          let giveUpJosn = res.data.chipsOrder[0].json
          let giveUp = giveUpJosn ? giveUpJosn.split('~') : []
          if (giveUp[1] === '') {
            this.value_giveUp = []
          } else {
            this.value_giveUp = giveUp[1].split('|')
          }
        }
      }).catch(err => {
        console.log(err)
      })
      querySurgeriesData(dispatch).then(res => {
        if (res.data.length === 0) {
          this.gradingList = {
            id: null,
            preoperativeTimiLevel: this.gradvalue,
            postoperativeTimiLevel: '',
            userId: this.$store.getters.userId,
            missionid: this.checkrowdata.dispatchId,
            medicalId: this.checkrowdata.medicalId,
            status: true
          }
        } else {
          this.gradingList = res.data[0]
        }
      }).catch(err => {
        console.log(err)
      })

      // 初步诊断
      findDiagnosesClcs({ dispatchId: dispatch }).then(res => {
        if (res.length !== 0) {
          let content = JSON.parse(res[0].diagnoseContent)
          switch (content[0]) {
            case 'undetermined':
              this.hide = true
              this.display = false
              break
            case 'siemidia':
              this.hide = true
              break
            case 'nstemidia':
              this.hide = true
              break
            case 'uadia':
              this.hide = true
              break
            case 'aorticdissection':
              this.hide = true
              break
            case 'pulmonary':
              this.hide = true
              this.display = false
              break
            case 'othercardiogenic':
              this.hide = true
              this.display = false
              break
            case 'Non-ACS_cardiogenic_chest_pain':
              this.hide = true
              this.display = false
              break
            case 'chest_pain_unknown':
              this.hide = true
              this.display = false
              break
            case 'chest_tightness_unknown':
              this.hide = true
              this.display = false
              break
          }
          /* eventTouchs 事件  */
          queryEventTouchsData(dispatch).then(res => {
            // console.log(res, 'res')
            if (content[0] === 'siemidia') {
              let switch_779 = ''
              let switch_770 = ''
              let switch_778 = ''
              if (res.data[779]) {
                switch_779 = res.data[779].property2
              }
              if (res.data[770]) {
                switch_770 = res.data[770].property2
              }
              if (res.data[778]) {
                switch_778 = res.data[778].property2
              }
              switch (switch_779) {
                case '0':
                  this.display = false
                  break
                case '1':
                  this.display = true
                  this.dis_662 = true
                  this.dis_779 = true
                  this.dis_490 = true
                  this.dis_770 = true
                  this.dis_118 = true
                  this.dis_D2W = true
                  break
                case '2':
                  if (switch_770 === '1' || switch_770 === '2') {
                    this.display = true
                    this.dis_770 = true
                    this.dis_118 = true
                  }
                  break
                case '3':
                  this.display = false
                  break
                case '4':
                  this.display = false
                  break
                case '5':
                  if (switch_778 === '0') {
                    this.display = true
                  } else {
                    this.display = false
                    this.dis_770 = true
                    this.dis_118 = true
                  }
                  break
              }
            } else if (content[0] === 'nstemidia' || content[0] === 'uadia') {
              let switch_772 = ''
              let switch_773 = ''
              if (res.data[772]) {
                switch_772 = res.data[772].property2
              }
              if (res.data[773]) {
                switch_773 = res.data[773].property2
              }
              switch (switch_772) {
                case '1':
                  this.display = false
                  break
                case '2':
                  if (switch_773 === '1' || switch_773 == '2' || switch_773 == '3' || switch_773 == '4' || switch_773 == '5') {
                    this.display = true
                    this.dis_779 = true
                    this.dis_490 = true
                    this.dis_770 = true
                    this.dis_118 = true
                    this.hidden = false
                  } else {
                    this.display = false
                  }
                  break
              }
            }
            for (let index in this.numberList) {
              let newIndex = this.numberList[index]
              for (let cIndex in this.cont) {
                if (cIndex.indexOf(newIndex) !== -1) {
                  if (res.data[newIndex] === undefined) {
                    this.cont[cIndex] = {
                      detail: '',
                      property2: '',
                      'hit_time': '',
                      id: null,
                      user: this.$store.getters.userId,
                      missionid: this.checkrowdata.dispatchId,
                      eventId: parseInt(cIndex.split('_')[1])
                    }
                    if (res.data['669'] === undefined) {
                      this.cont.obj_669.property2 = '0'
                    } else {
                      this.cont.obj_669.property2 = res.data['669'].property2
                    }
                    if (res.data['670'] === undefined) {
                      this.cont.obj_670.property2 = '0'
                    } else {
                      this.cont.obj_670.property2 = res.data['670'].property2
                    }
                    if (res.data['671'] === undefined) {
                      this.cont.obj_671.property2 = '0'
                    } else {
                      this.cont.obj_671.property2 = res.data['671'].property2
                    }
                    if (res.data['672'] === undefined) {
                      this.cont.obj_672.property2 = '0'
                    } else {
                      this.cont.obj_672.property2 = res.data['672'].property2
                    }
                    if (res.data['673'] === undefined) {
                      this.cont.obj_673.property2 = '0'
                    } else {
                      this.cont.obj_673.property2 = res.data['673'].property2
                    }
                    if (res.data['713'] === undefined) {
                      this.cont.obj_713.property2 = '0'
                    } else {
                      this.cont.obj_713.property2 = res.data['713'].property2
                    }
                  } else {
                    this.cont[cIndex] = res.data[newIndex]
                    if (newIndex === '668') {
                      this.radio_668 = this.cont[cIndex].property2 ? this.cont[cIndex].property2.split('~')[0] : ''
                      this.input_668 = this.cont[cIndex].property2 ? this.cont[cIndex].property2.split('~')[1] : ''
                    }
                    if (newIndex === '204') {
                      this.radio_204 = this.cont[cIndex].property2 ? this.cont[cIndex].property2.split('~')[0] : ''
                      this.input_204 = this.cont[cIndex].property2 ? this.cont[cIndex].property2.split('~')[1] : ''
                    }
                    if (this.checkrowdata.comeway === '院内发病') {
                      if (newIndex === '666') {
                        let cagObj = this.cont[cIndex].detail ? JSON.parse(this.cont[cIndex].detail) : ''
                        this.cagItemList_666 = cagObj.CAG
                        // console.log("this.cagItemList_666-1", this.cagItemList_666)
                        let listTime = []
                        if (this.cagItemList_666 && this.cagItemList_666.length > 0) {
                          this.cagItemList_666.forEach(item => {
                            /* 冠脉造影选择框   */
                            // console.log("item", item)
                            this.cagList_666.push(item.portindex + ':' + item.portname)
                            item.portparam.forEach((res, index) => {
                              let code = ''
                              let name = ''
                              let value = ''
                              code = res.code
                              name = res.name
                              value = res.value
                              item.portparam[index] = code + ' ' + name + ' ' + value
                              if (index === 8) {
                                if (value === '') {
                                  item.portparam[13] = []
                                } else {
                                  item.portparam[13] = value ? value.split(';') : []
                                }
                              }
                              if (index === 9) {
                                item.portparam[9] = value
                              }
                              if (res.name === '导丝通过时间') {
                                listTime.push(res.value)
                              }
                            })
                          })
                        }
                        let newTime = listTime.filter(function (s) {
                          return s && s.trim()
                        })
                      }
                      let time_46 = ''
                      if (res.data[46]) {
                        time_46 = res.data[46].hit_time
                      }
                      if (time_46 && newTime.sort()[0]) {
                        let Time_46 = new Date(time_46)
                        let Time_new = new Date(newTime.sort()[0])
                        let s1 = Time_46.getTime()
                        let s2 = Time_new.getTime()
                        let total = (s2 - s1) / 1000
                        this.inputTime = Math.round(total)
                      }
                    } else {
                      let newTime = []
                      if (newIndex === '666' && this.cont[cIndex].detail !== "CAG") {
                        let cagObj = this.cont[cIndex].detail ? JSON.parse(this.cont[cIndex].detail) : ''
                        // console.log("this.cagItemList_666-2", this.cagItemList_666)

                        this.cagItemList_666 = cagObj.CAG
                        let listTime = []
                        if (this.cagItemList_666 && this.cagItemList_666.length > 0) {
                          this.cagItemList_666.forEach(item => {
                            /* 冠脉造影选择框   */

                            this.cagList_666.push(item.portindex + ':' + item.portname)
                            item.portparam.forEach((res, index) => {
                              let code = ''
                              let name = ''
                              let value = ''
                              code = res.code
                              name = res.name
                              value = res.value
                              item.portparam[index] = code + ' ' + name + ' ' + value
                              if (index === 8) {
                                if (value === '') {
                                  item.portparam[13] = []
                                } else {
                                  item.portparam[13] = value ? value.split(';') : []
                                }
                              }
                              if (index === 9) {
                                item.portparam[9] = value
                              }
                              if (res.name === '导丝通过时间') {
                                listTime.push(res.value)
                              }
                            })
                          })
                          // console.log("this.cagItemList_666-2", this.cagItemList_666)
                        }
                        newTime = listTime.filter(function (s) {
                          return s && s.trim();
                        })
                      }
                      let time_46 = ''
                      if (res.data[46]) {
                        time_46 = res.data[46].hit_time
                      }
                      if (time_46 && newTime.sort()[0]) {
                        let Time_46 = new Date(time_46)
                        let Time_new = new Date(newTime.sort()[0])
                        let s1 = Time_46.getTime()
                        let s2 = Time_new.getTime()
                        let total = (s2 - s1) / 1000 / 60
                        this.inputTime = Math.round(total)
                      }
                    }
                    if (newIndex === '676') {
                      this.checkListThree = this.cont[cIndex].property2 ? this.cont[cIndex].property2.split('|') : []
                    }
                    if (newIndex === '675') {
                      if (this.cont[cIndex].property2 === '') {
                        this.value_675 = ['00']
                      } else {
                        this.value_675 = this.cont[cIndex].property2.split('|')
                      }
                    }
                  }
                }
              }
            }
          }).catch(err => {
            console.log(err)
          })
        } else {
          this.hide = false
          this.display = true
        }

      }).catch(err => {
        this.$message.error(err)
      })
    },
    // 治疗过程并发症 无
    handleCheck_pro(val) {
      if (val.indexOf('无') === -1) { } else {
        this.value_pro.splice(0, val.length - 1)
      }
    },
    /* 术中并发症  */
    handleCheck_675(val) {
      if (val[val.length - 1] == "00") {
        this.value_675 = ['00']
      } else {
        let index = val.indexOf('00')
        if (index > -1) {
          this.value_675.splice(index, 1)
        }
      }
    },
    // 冠脉术中处理
    handlecheck_666(val) {
      let Vindex = val.indexOf('无')
      if (val[val.length - 1] == "无") {
        val.splice(0, val.length - 1)
      } else {
        if (Vindex > -1) {
          val.splice(Vindex, 1)
        }
      }
    },
    /* 冠脉造影 8*/
    one_666(check, e) {
      let index = e.target.defaultValue.split(':')[0]
      let name = e.target.defaultValue.split(':')[1]
      if (check === true) {
        // console.log("this.cagItemList_666",this.cagItemList_666)
        if (this.cagItemList_666 === undefined) {
          console.log("不存在数据")
          this.cagItemList_666 = []
        }
        this.cagItemList_666.push({
          portindex: index,
          portname: name,
          portparam: ["", "", "0 支架内血栓 否", "0 是否分叉病变 否", "0 是否CTO 否",
            "0 钙化病变 否", "1 罪犯病变 是", "1 PCI 是", "", "", "", "", ""
          ]
        })
      } else {
        console.log("移除选项")
        for (let itemIndex in this.cagItemList_666) {
          if (e.target.defaultValue.indexOf(this.cagItemList_666[itemIndex].portindex + ":" + this.cagItemList_666[
            itemIndex].portname) > -1) {
            this.cagItemList_666.splice(itemIndex, 1)
          }
        }
      }
      // console.log("this.cagItemList_666",this.cagItemList_666)
    },
    /* 保存/修改 数据 */
    saveTreatment() {
      let tips = ""
      if (this.dispatch_data.is_bypass_emergency !== '' && !this.dispatch_data.is_bypass_emergency) {
        tips = "绕行急诊"
      }
      if (this.dispatch_data.is_bypass_ccu !== '' && !this.dispatch_data.is_bypass_ccu) {
        tips = "绕行CUU"
      }
      if (tips) {
        this.$message.warning(tips + "未选择");
        return
      }
      const contBack = JSON.parse(JSON.stringify(this.cont))
      let arr = []
      for (let contIndex in contBack) {
        if (contIndex === 'obj_666') {
          // console.log(this.cagItemList_666,"this.cagItemList_666")
          // console.log("this.cagItemList_666-3", this.cagItemList_666)

          // return 
          if (this.cagItemList_666 && this.cagItemList_666.length > 0) {
            for (let ies = 0; ies < this.cagItemList_666.length; ies++) {
              let res_value = this.checkValueIsNull(this.cagItemList_666[ies].portparam)
              if (res_value) {
                this.$message.warning(res_value + "未填写！");
                return
              }
            }
          }
          let back666 = this.cagItemList_666 === undefined ? [] : JSON.parse(JSON.stringify(this.cagItemList_666))
          let newCAG = {}
          let newProperty2 = [] // property2的值
          if (back666.length !== 0) {
            back666.forEach(ele => {
              newProperty2.push(ele.portindex)
              let portparamBack = []
              ele.portparam.forEach((item, index) => {
                let code = ''
                let name = ''
                let value = ''
                if (index === 8) {
                  let codeArr = []
                  if (ele.portparam[13].length === 0) {
                    code = ''
                    name = ''
                    value = ''
                    ele.portparam.splice(13, 1)
                  } else {
                    ele.portparam[13].forEach(res => {
                      codeArr.push(this.option_66666[res])
                    })
                    code = codeArr.join('|')
                    name = '术中处理'
                    value = ele.portparam[13].join(';')
                    ele.portparam.splice(13, 1)
                  }
                } else {
                  [code, name, value] = (item || '').split(' ')
                }
                if (index === 9) {
                  code = undefined
                  name = '导丝通过时间'
                  value = item
                }
                item = {
                  'code': (code || ''),
                  'name': (name || ''),
                  'value': (value || '')
                }
                portparamBack.push(item)
              })
              ele.portparam = portparamBack
            })
          }
          newCAG.CAG = back666
          this.cont[contIndex].detail = newCAG
          // console.log("this.cont[contIndex].detail", this.cont[contIndex].detail)
          this.cont[contIndex].property2 = newProperty2.join('|')
          this.cureObj._666 = this.cont[contIndex]
        } else if (contIndex === 'obj_596') {
          this.cureObj._596 = this.cont[contIndex]
        } else if (contIndex === 'obj_704') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '本院急诊科'
          } else if (this.cont[contIndex].property2 === '2') {
            this.cont[contIndex].detail = '本院内心科'
          } else if (this.cont[contIndex].property2 === '3') {
            this.cont[contIndex].detail = '其他科室'
          } else if (this.cont[contIndex].property2 === '') {
            this.cont[contIndex].detail = ''
          }
          this.cureObj._704 = this.cont[contIndex]
        } else if (contIndex === 'obj_705') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '是'
          } else if (this.cont[contIndex].property2 === '0') {
            this.cont[contIndex].detail = '否'
          }
          this.cureObj._705 = this.cont[contIndex]
        } else if (contIndex === 'obj_204') {
          if (this.radio_204 === '1') {
            this.cont[contIndex].detail = '合适'
            this.cont[contIndex].property2 = '1'
          } else if (this.radio_204 === '2') {
            if (this.input_204 === '1') {
              this.cont[contIndex].detail = '是'
              this.cont[contIndex].property2 = '2~1'
            } else {
              this.cont[contIndex].detail = '否'
              this.cont[contIndex].property2 = '2~0'
            }
          } else if (this.radio_204 === '3') {
            this.cont[contIndex].detail = '未筛查'
            this.cont[contIndex].property2 = '3'
          } else if (this.radio_204 === '') {
            this.cont[contIndex].detail = ''
            this.cont[contIndex].property2 = ''
          }
          this.cureObj._204 = this.cont[contIndex]
        } else if (contIndex === 'obj_206') {
          this.cureObj._206 = this.cont[contIndex]
        } else if (contIndex === 'obj_57') {
          this.cureObj._57 = this.cont[contIndex]
        } else if (contIndex === 'obj_104') {
          this.cureObj._104 = this.cont[contIndex]
        } else if (contIndex === 'obj_498') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '是'
          } else if (this.cont[contIndex].property2 === '0') {
            this.cont[contIndex].detail = '否'
          }
          this.cureObj._498 = this.cont[contIndex]
        } else if (contIndex === 'obj_708') {
          this.cureObj._708 = this.cont[contIndex]
        } else if (contIndex === 'obj_709') {
          this.cureObj._709 = this.cont[contIndex]
        } else if (contIndex === 'obj_595') {
          this.cureObj._595 = this.cont[contIndex]
        } else if (contIndex === 'obj_50710') {
          this.cureObj._50710 = this.cont[contIndex]
        } else if (contIndex === 'obj_766') {
          this.cureObj._766 = this.cont[contIndex]
          // console.log("this.cureObj._766.hit_time",this.cureObj._766.hit_time)
          if (this.cureObj._766.hit_time === "" && !this.cureObj._766.hit_time && !this.conditions.some(el => this.checkrowdata.diagnoseContent.includes(el))) {
            tips = "术中抗凝给药时间"
          }
        } else if (contIndex === 'obj_592') {
          if (this.cont[contIndex].property2 === '0') {
            this.cont[contIndex].detail = '无禁忌或有适应症'
          } else if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '有禁忌症'
          } else if (this.cont[contIndex].property2 === '11') {
            this.cont[contIndex].detail = '有绝对禁忌症'
          } else if (this.cont[contIndex].property2 === '') {
            this.cont[contIndex].detail = ''
          }
          this.cureObj._592 = this.cont[contIndex]
        } else if (contIndex === 'obj_576') {
          this.cureObj._576 = this.cont[contIndex]
        } else if (contIndex === 'obj_593') {
          this.cureObj._593 = this.cont[contIndex]
        } else if (contIndex === 'obj_112') {
          this.cureObj._112 = this.cont[contIndex]
        } else if (contIndex === 'obj_113') {
          this.cureObj._113 = this.cont[contIndex]
          // console.log("this.cureObj._113",this.cureObj._113)
          if (this.cureObj._113.hit_time === "" && !this.cureObj._113.hit_time) {
            tips = "激活导管室"
          }

        } else if (contIndex === 'obj_114') {
          this.cureObj._114 = this.cont[contIndex]
        } else if (contIndex === 'obj_713') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '是'
          } else if (this.cont[contIndex].property2 === '0') {
            this.cont[contIndex].detail = '否'
          }
          this.cureObj._713 = this.cont[contIndex]
        } else if (contIndex === 'obj_662') {
          this.cureObj._662 = this.cont[contIndex]
        } else if (contIndex === 'obj_663') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '普通肝素'
          } else if (this.cont[contIndex].property2 === '2') {
            this.cont[contIndex].detail = '低分子肝素'
          } else if (this.cont[contIndex].property2 === '3') {
            this.cont[contIndex].detail = '比伐卢定'
          } else if (this.cont[contIndex].property2 === '4') {
            this.cont[contIndex].detail = '黄达肝葵钠'
          } else if (this.cont[contIndex].property2 === '') {
            this.cont[contIndex].detail = ''
          }
          this.cureObj._663 = this.cont[contIndex]
        } else if (contIndex === 'obj_711') {
          this.cureObj._711 = this.cont[contIndex]
        } else if (contIndex === 'obj_712') {
          this.cureObj._712 = this.cont[contIndex]
        } else if (contIndex === 'obj_664') {
          if (this.cont[contIndex].property2 === "" && !this.cont[contIndex].property2) {
            tips = "入路"
          }
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '桡动脉(左侧)'
          } else if (this.cont[contIndex].property2 === '2') {
            this.cont[contIndex].detail = '桡动脉(右侧)'
          } else if (this.cont[contIndex].property2 === '3') {
            this.cont[contIndex].detail = '股动脉'
          } else if (this.cont[contIndex].property2 === '4') {
            this.cont[contIndex].detail = '其他'
          } else if (this.cont[contIndex].property2 === '') {
            this.cont[contIndex].detail = ''
          }
          this.cureObj._664 = this.cont[contIndex]
        } else if (contIndex === 'obj_441') {
          this.cureObj._441 = this.cont[contIndex]
        } else if (contIndex === 'obj_490') {
          this.cureObj._490 = this.cont[contIndex]
        } else if (contIndex === 'obj_117') {
          this.cureObj._117 = this.cont[contIndex]
        } else if (contIndex === 'obj_118') {
          this.cureObj._118 = this.cont[contIndex]
        } else if (contIndex === 'obj_665') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '紧急介入治疗'
          } else if (this.cont[contIndex].property2 === '2') {
            this.cont[contIndex].detail = '急诊仅造影'
          } else if (this.cont[contIndex].property2 === '3') {
            this.cont[contIndex].detail = '24H介入治疗'
          } else if (this.cont[contIndex].property2 === '4') {
            this.cont[contIndex].detail = '72H介入治疗'
          } else if (this.cont[contIndex].property2 === '5') {
            this.cont[contIndex].detail = '早期仅造影'
          } else if (this.cont[contIndex].property2 === '6') {
            this.cont[contIndex].detail = '择期介入治疗'
          } else if (this.cont[contIndex].property2 === '7') {
            this.cont[contIndex].detail = '转运PCI'
          } else if (this.cont[contIndex].property2 === '8') {
            this.cont[contIndex].detail = 'CABG'
          } else if (this.cont[contIndex].property2 === '') {
            this.cont[contIndex].detail = ''
          }
          this.cureObj._665 = this.cont[contIndex]
        } else if (contIndex === 'obj_667') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = 'IVUS'
          } else if (this.cont[contIndex].property2 === '2') {
            this.cont[contIndex].detail = 'OCT'
          } else if (this.cont[contIndex].property2 === '3') {
            this.cont[contIndex].detail = '其他'
          } else if (this.cont[contIndex].property2 === '4') {
            this.cont[contIndex].detail = '未做'
          } else if (this.cont[contIndex].property2 === '') {
            this.cont[contIndex].detail = ''
          }
          this.cureObj._667 = this.cont[contIndex]
        } else if (contIndex === 'obj_668') {
          if (this.radio_668 === '1') {
            this.cont[contIndex].detail = 'FFR'
            this.cont[contIndex].property2 = this.radio_668 + '~' + this.input_668
          } else if (this.radio_668 === '2') {
            this.cont[contIndex].detail = '其他'
            this.cont[contIndex].property2 = '2'
          } else if (this.radio_668 === '3') {
            this.cont[contIndex].detail = '未做'
            this.cont[contIndex].property2 = '3'
          } else if (this.radio_668 === '4') {
            this.cont[contIndex].detail = 'iFR'
            this.cont[contIndex].property2 = this.radio_668 + '~' + this.input_668
          } else if (this.radio_668 === '5') {
            this.cont[contIndex].detail = 'IMR'
            this.cont[contIndex].property2 = this.radio_668 + '~' + this.input_668
          } else if (this.radio_668 === '') {
            this.cont[contIndex].detail = ''
            this.cont[contIndex].property2 = ''
          }
          this.cureObj._668 = this.cont[contIndex]
        } else if (contIndex === 'obj_669') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '是'
          } else if (this.cont[contIndex].property2 === '0') {
            this.cont[contIndex].detail = '否'
          }
          this.cureObj._669 = this.cont[contIndex]
        } else if (contIndex === 'obj_670') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '是'
          } else if (this.cont[contIndex].property2 === '0') {
            this.cont[contIndex].detail = '否'
          }
          this.cureObj._670 = this.cont[contIndex]
        } else if (contIndex === 'obj_671') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '是'
          } else if (this.cont[contIndex].property2 === '0') {
            this.cont[contIndex].detail = '否'
          }
          this.cureObj._671 = this.cont[contIndex]
        } else if (contIndex === 'obj_672') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '是'
          } else if (this.cont[contIndex].property2 === '0') {
            this.cont[contIndex].detail = '否'
          }
          this.cureObj._672 = this.cont[contIndex]
        } else if (contIndex === 'obj_673') {
          if (this.cont[contIndex].property2 === '1') {
            this.cont[contIndex].detail = '是'
          } else if (this.cont[contIndex].property2 === '0') {
            this.cont[contIndex].detail = '否'
          }
          this.cureObj._673 = this.cont[contIndex]
        } else if (contIndex === 'obj_675') {
          let labelArr_675 = []
          for (let vIndex in this.value_675) {
            if (this.value_675[vIndex] === '00') {
              labelArr_675.push('无')
            } else if (this.value_675[vIndex] === '01') {
              labelArr_675.push('恶性心律失常')
            } else if (this.value_675[vIndex] === '02') {
              labelArr_675.push('低血压')
            } else if (this.value_675[vIndex] === '03') {
              labelArr_675.push('慢血流/无复流')
            } else if (this.value_675[vIndex] === '04') {
              labelArr_675.push('血管夹层')
            } else if (this.value_675[vIndex] === '05') {
              labelArr_675.push('非干预血管急性闭塞')
            } else if (this.value_675[vIndex] === '06') {
              labelArr_675.push('血管穿孔')
            } else if (this.value_675[vIndex] === '07') {
              labelArr_675.push('死亡')
            } else if (this.value_675[vIndex] === '08') {
              labelArr_675.push('心源性休克')
            } else if (this.value_675[vIndex] === '09') {
              labelArr_675.push('严重缓慢型心律失常')
            } else if (this.value_675[vIndex] === '10') {
              labelArr_675.push('血栓栓塞')
            } else if (this.value_675[vIndex] === '99') {
              labelArr_675.push('其他')
            }
          }
          this.cont[contIndex].detail = labelArr_675.join(';')
          this.cont[contIndex].property2 = this.value_675.join('|')
          this.cureObj._675 = this.cont[contIndex]
        } else if (contIndex === 'obj_120') {
          this.cureObj._120 = this.cont[contIndex]
        } else if (contIndex === 'obj_676') {
          let cLTDetail_676 = []
          for (let cLTIndex in this.checkListThree) {
            if (this.checkListThree[cLTIndex] === '01') {
              cLTDetail_676.push('症状不明显延误诊断')
            } else if (this.checkListThree[cLTIndex] === '02') {
              cLTDetail_676.push('家属未到场')
            } else if (this.checkListThree[cLTIndex] === '03') {
              cLTDetail_676.push('医生决策延误')
            } else if (this.checkListThree[cLTIndex] === '04') {
              cLTDetail_676.push('排队挂号、缴费、办住院时间长')
            } else if (this.checkListThree[cLTIndex] === '05') {
              cLTDetail_676.push('急诊科处理时间长')
            } else if (this.checkListThree[cLTIndex] === '06') {
              cLTDetail_676.push('手术期间出现并发症')
            } else if (this.checkListThree[cLTIndex] === '07') {
              cLTDetail_676.push('超过再灌注时间')
            } else if (this.checkListThree[cLTIndex] === '08') {
              cLTDetail_676.push('未实施绕行急诊方案')
            } else if (this.checkListThree[cLTIndex] === '09') {
              cLTDetail_676.push('导管室人员未到位')
            } else if (this.checkListThree[cLTIndex] === '10') {
              cLTDetail_676.push('药物缺乏')
            } else if (this.checkListThree[cLTIndex] === '11') {
              cLTDetail_676.push('知情同意时间过长')
            } else if (this.checkListThree[cLTIndex] === '12') {
              cLTDetail_676.push('病情不稳定')
            } else if (this.checkListThree[cLTIndex] === '13') {
              cLTDetail_676.push('绕行急诊科但未直接入导管室')
            } else if (this.checkListThree[cLTIndex] === '14') {
              cLTDetail_676.push('导管室占台')
            } else if (this.checkListThree[cLTIndex] === '15') {
              cLTDetail_676.push('转运时间长')
            } else if (this.checkListThree[cLTIndex] === '16') {
              cLTDetail_676.push('经费问题')
            } else if (this.checkListThree[cLTIndex] === '17') {
              cLTDetail_676.push('心内科会诊时间长')
            } else if (this.checkListThree[cLTIndex] === '18') {
              cLTDetail_676.push('血管通路困难')
            } else if (this.checkListThree[cLTIndex] === '19') {
              cLTDetail_676.push('难以绕行病变区域')
            } else if (this.checkListThree[cLTIndex] === '20') {
              cLTDetail_676.push('心脏骤停或需要气管插管再PCI')
            } else if (this.checkListThree[cLTIndex] === '21') {
              cLTDetail_676.push('急需影像学资料再行PCI')
            } else if (this.checkListThree[cLTIndex] === '99') {
              cLTDetail_676.push('其他原因')
            }
          }
          this.cont[contIndex].detail = cLTDetail_676.join(';')
          this.cont[contIndex].property2 = this.checkListThree.join('|')
          this.cureObj._676 = this.cont[contIndex]
        } else if (contIndex === 'obj_597') {
          this.cureObj._597 = this.cont[contIndex]
        } else if (contIndex === 'obj_598') {
          this.cureObj._598 = this.cont[contIndex]
        } else if (contIndex === 'obj_594') {
          this.cureObj._594 = this.cont[contIndex]
        } else if (contIndex === 'obj_766') {
          this.cureObj._766 = this.cont[contIndex]
          // console.log("this.this.cureObj._766",this.cureObj._766)
          if (this.cureObj._766.hit_time === "" && !this.cureObj._766.hit_time && !this.conditions.some(el => this.checkrowdata.diagnoseContent.includes(el))) {
            tips = "术中抗凝给药时间"
          }
        }
      }
      let formData = new FormData()
      for (let cureindex in this.cureObj) {
        if (cureindex === "_666") {
          let temp_date = new Date()
          let create_uuid = this.createuuid() + "-" + temp_date.getTime()
          formData.append("epid", create_uuid)
          formData.append("id", create_uuid)
          formData.append("user", Number(this.$store.getters.userId))
          formData.append("userId", Number(this.$store.getters.userId))
          formData.append("missionId", this.checkrowdata.dispatchId)
          formData.append("mission", this.checkrowdata.dispatchId)
          formData.append("type", 2)
          formData.append("event_id", 666)
          formData.append("state", 1)
          formData.append("hit_time", format(temp_date, 'YYYY-MM-DD HH:mm:ss'))
          formData.append("detail", JSON.stringify(this.cureObj[cureindex].detail))
          console.log("this.cureObj[cureindex].detail", this.cureObj[cureindex].detail)
          let temp_cagList_666_arr = []
          this.cagList_666.forEach(el => {
            if (el) {
              temp_cagList_666_arr.push(el.split(":")[0])
            }
          })
          if (temp_cagList_666_arr.length > 1) {
            formData.append("property2", temp_cagList_666_arr.join("|"))

          } else if (temp_cagList_666_arr.length === 1) {
            formData.append("property2", temp_cagList_666_arr[0])
          }
        } else {
          arr.push(JSON.stringify(this.cureObj[cureindex]))
        }

      }

      let newArr = arr.join('#')
      console.log("arr", arr)
      console.log("newArr", newArr)
      if (this.value_pro && this.value_pro.length > 0) {
        this.findchipsByInstance.json.complication = this.value_pro.join(';')
      }
      if (this.jsonObj.dosage) {
        this.findchipsByInstance.json.dosage = this.jsonObj.dosage
      }
      if (this.jsonObj.medicineName) {
        this.findchipsByInstance.json.medicineName = this.jsonObj.medicineName
      }
      let cvData = []
      let guData = []
      this.value_conservative.forEach((item, index) => {
        if (item === '1') {
          cvData.push('生命体征平稳，无持续缺血表现')
        } else if (item === '2') {
          cvData.push('超过再灌注时间窗')
        } else if (item === '3') {
          cvData.push('高出血风险')
        } else if (item === '4') {
          cvData.push('严重肝肾功能不全')
        } else if (item === '5') {
          cvData.push('经济原因限制')
        } else if (item === '6') {
          cvData.push('拒绝或放弃')
        } else if (item === '7') {
          cvData.push('出血活动期')
        } else if (item === '9') {
          cvData.push('其他原因')
        }
      })
      this.value_giveUp.forEach((item, index) => {
        if (item === '1') {
          guData.push('生命体征平稳，无持续缺血表现')
        } else if (item === '2') {
          guData.push('超过再灌注时间窗')
        } else if (item === '3') {
          guData.push('高出血风险')
        } else if (item === '4') {
          guData.push('严重肝肾功能不全')
        } else if (item === '5') {
          guData.push('经济原因限制')
        } else if (item === '6') {
          guData.push('拒绝或放弃')
        } else if (item === '7') {
          guData.push('出血活动期')
        } else if (item === '9') {
          guData.push('其他原因')
        }
      })
      this.reason[0].json = cvData.join(';') + "~" + this.value_conservative.join('|')
      this.reason[1].json = guData.join(';') + "~" + this.value_giveUp.join('|')
      let neworder = this.findchipsByInstance
      let newsur = this.gradingList
      let reason = this.reason
      let data = {
        cure: newArr,
        sur: newsur,
        order: neworder,
        reason: reason
      }
      if (tips) {
        this.$message.warning(tips + "未填写！");
        return
      }
      querysaveTreatmentData(data).then(res => {
        if (res.code === 0) {
          saveCag(formData).then(res => {
            if (res.code === 0) {
              this.$message({
                message: '保存成功',
                type: 'success'
              })
              this.getEventTouchData()
            }
          })
        } else {
          this.$message({
            message: '保存失败',
            type: 'error'
          })
          this.getEventTouchData()
        }
      }).catch(err => {
        this.$message.error(err)
      })
    },
    getDispatchData() {
      const formData = new FormData()
      formData.append("apiToken", this.$store.getters.token)
      formData.append("dispatchId", this.checkrowdata.dispatchId)
      getDispatchData(formData).then(res => {
        if (res.code === 0) {
          this.dispatch_data = res.data
        }
      })
    },
    modifyDispatchData() {
      const formData = new FormData()
      formData.append("apiToken", this.$store.getters.token)
      formData.append("dispatchId", this.checkrowdata.dispatchId)
      formData.append("is_bypass_emergency", this.dispatch_data.is_bypass_emergency)
      formData.append("is_bypass_ccu", this.dispatch_data.is_bypass_ccu)
      modifyDispatchData(formData).then(res => {
        if (res.code === 0) {

        }
      })
    },
    changeRX() {
      this.modifyDispatchData()
    },
    checkValueIsNull(val) {
      if (!val) {
        return true
      }
      let res_val = ""
      for (let i = 0; i < val.length; i++) {
        console.log("val[i]"+val[i]+"1",val[i])
        if (val[i] == '' || !val[i] ||val[i] == '  '  || val[i].length === 0) {
          switch (i) {
            case 0:
              res_val = "狭窄程度"
              break;
            case 1:
              res_val = "造影时TIMI血流"
              break;
            case 2:
              res_val = "支架内血栓"
              break;
            case 3:
              res_val = "是否分叉病变"
              break;
            case 4:
              res_val = "是否CTO"
              break;
            case 5:
              res_val = "钙化病变"
              break;
            case 6:
              res_val = "罪犯病变"
              break;
            case 7:
              res_val = "PCI"
              break;
            // case 8:
            //   res_val = "术中处理"
            //   break;
            // case 9:
            //   // res_val = "导丝通过时间"
            //   break;
            case 10:
              res_val = "术后TIMI血流"
              break;
            case 11:
              res_val = "植入支架个数"
              break;
            case 12:
              console.log("val[11]", val[11])
              if (val[11] === "1 植入支架个数 0枚") {

              } else {
                res_val = "支架种类"
              }

              break;
            case 13:
              res_val = "术中处理"
              break;
          }
          if (res_val) {
            return res_val
          }
        }
      }
    },
    createuuid() {
      var s = [];
      var hexDigits = "0123456789abcdef";
      for (var i = 0; i < 32; i++) {
        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
      }
      s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
      s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
      s[8] = s[13] = s[18] = s[23];
      var uuid = s.join("");
      return uuid;
    },
  }
}
</script>

<style scoped>
#box {
  padding: 10px 30px;
}

.el-row {
  margin-bottom: 15px;
}

.el-col-4 {
  width: auto;
  margin: 5px 0;
}

.el-col-5 {
  width: auto;
  margin-bottom: 5px;
}

.el-col-6 {
  width: auto;
  margin: 5px 0;
}

.el-col-2 {
  width: auto;
}

.el-col-3 {
  width: auto;
  margin: 5px 0;
}

.topBox {
  width: 100%;
  background-color: #F9F9F9;
  padding: 10px 20px;
}

.bottomBox {
  margin-top: 10px;
  margin-bottom: 10px;
  width: 100%;
  background-color: #F9F9F9;
  padding: 10px 20px;
}

.topConter {
  padding: 0 20px;
}

.bottonConter {
  padding: 0 15px;
  margin-bottom: 10px;
}

/* .el-checkbox {
		margin: 10px 20px;
	} */
.red-star::before {
  content: "*";
  color: red;
}
</style>
